AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include( 'shared.lua' )

function ENT:Initialize()
	self.BaseClass.Initialize(self)
end

function ENT:SpawnFunction( ply, tr )

if ( !tr.Hit ) then return end
	
	local SpawnPos = tr.HitPos + tr.HitNormal * 100
	
	local ent = ents.Create( "ice_mining_laser_2" )
		ent:SetPos( SpawnPos )
		ent:Spawn()
		ent:Activate()
		ent.Owner = ply 
	return ent
end

function ENT:Think()
	self.BaseClass.BaseClass.Think(self)

    self.percent = math.Round((self.pulls/self.LaserCycle)*100)
	self:SetOverlayText(self.PrintName.."\n".."Cycle: "..self.percent.."%")

	Wire_TriggerOutput(self.Entity,"Cycle %",self.percent)

	if self.InputActive and self.nextpull < CurTime() then
		self:Mine()
	elseif self.pulls < self.LaserCycle and self.pulls > 0 then
		if self.nextpull < CurTime() then
			self:Mine()
		end
	end

end


